How do use a command where you changed its installation directory in linux? - linux

Hello I am on a linux server running 2.6.18-274.e15. I have installed a program called scons in order to compile a program called rosetta. In order to get scons to install when I ran it's python install I used the following command
python setup.py install flexed --prefix=.
This was because I am unable to use the folder it was trying to download into with my user status. When I call "scons --version" I am getting "command not found".
What I am wondering:
Is running scons even possible with my setup?
If so, what command would I use?
Thanks!

you need to add the directory of your binary to your path, in the shell:
$ export PATH=$PATH:/the/dir/of/your/binary

Related

How to install Linux packages in Replit

I tried to use nasm in a bash project on Replit (educator) but it failed as nasm was not installed.
However, there are some assembly projects on Replit. So I forked a project, added my code, and boom it worked.
How nasm got installed in that project? Dunno, cause it's nowhere explained.
Now, I'd like to use external functions like printf in the assembly code. The code being x86-32, I need to install something similar to glibc-devel.i686 and glibc-devel (this on Fedora). Seems to be gcc-multilib in Ubuntu.
My question is : how do we install Linux packages in a bash project on Replit? Thanks for the help.
To install a Linux package in a bash project on Replit, run the command directly from the console or shell. If the command is found on Nix, you'll get an invite to run it from Nix and the package will be added to the config file replit.nix in your poject.
> nasm --version
nasm: command not installed, but was located via Nix.
Would you like to run nasm from Nix and add it to your replit.nix file? [Yn]:
> cat replit.nix
{ pkgs }: {
deps = [
pkgs.nasm
pkgs.bashInteractive
];
}
However, if the command you're trying to run is in a script, pressing the "Run" button or launching the script from the shell will only give an error "Command not found".
You can also add the package to your project by directly editing replit.nix.
You can check if your package exists in Nix using the NixOS Search - Packages page.
In bash type:
$ nix-env -iA nixpkgs.nasm

How to run Qtcreator from terminal in Ubuntu?

Hi I have QtInstalled with the official qt installer (I haven't used the package with the name "qtcreator").
I need to run QtCreator from terminal but I can't locate the executable.
I'm using Ubuntu 16.04.
Probably you can find the executable in opt directory the location will be as this /opt/Qt/Tools/QtCreator/bin and you can run it through terminal as ./qtcreator
Latest QtCreator should by default be installed in
${HOME}/Qt/Tools/QtCreator/bin/
And you have two start-up options, the executable qtcreator or the shell script qtcreator.sh
To run the executable, type
~/Qt/Tools/QtCreator/bin/qtcreator
To run the shell script, type
~/Qt/Tools/QtCreator/bin/qtcreator.sh
Whic one to use: From the top portion of qtcreator.sh, it states that if you have library name conflicts (such as having same library names used by qtcreator with your own LD_LIBRARY_PATH), you may want to start with the shell script, rather than the bare executable.
Windows linux subsystem users
In case you have ubuntu as a subsystem for win10, it's located in your AppData folder (installing with sudo apt install command):
Also, you cannot run qtcreator from terminal as graphical interface is not supported by defeault. You need to instal X-server app first (https://sourceforge.net/projects/xming/) and then you can run QT from terminal.
C:\Users\[YOUR_USERNAME]\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\usr\share\qtcreator
Or, it's in usr/lintian/overrides
But you should not modify anything inside this linux root, as it may lead to data loss.
For me it wasn't in the /opt directory, but rather the location I've chosen in the /home/user/ directory.
More specifically: /home/user/Qt5.12.1/Tools/QtCreator/bin/qtcreator

'python3' is not recognized as an internal or external command, operable program or batch file

I am using Python 3.5.2 version on Windows 7 and tried using python3 app.py. I am getting this error message:
'python3' is not recognized as an internal or external command,
operable program or batch file.
Is there any specific cause about why the python3 command is not working?
I also verified that the PATH is added to environment variables.
There is no python3.exe file, that is why it fails.
Try:
py
instead.
py is just a launcher for python.exe. If you have more than one python versions installed on your machine (2.x, 3.x) you can specify what version of python to launch by
py -2 or
py -3
You can also try this:
Go to the path where Python is installed in your system. For me it was something like C:\Users\\Local Settings\Application Data\Programs\Python\Python37
In this folder, you'll find a python executable. Just create a duplicate and rename it to python3. Works every time.
Python3.exe is not defined in windows
Specify the path for required version of python when you need to used it by creating virtual environment for your project
Python 3
virtualenv --python=C:\PATH_TO_PYTHON\python.exe environment
Python2
virtualenv --python=C:\PATH_TO_PYTHON\python.exe environment
then activate the environment using
.\environment\Scripts\activate.ps1
Yes, I think for Windows users you need to change all the python3 calls to python to solve your original error. This change will run the Python version set in your current environment. If you need to keep this call as it is (aka python3) because you are working in cross-platform or for any other reason, then a work around is to create a soft link. To create it, go to the folder that contains the Python executable and create the link. For example, this worked in my case in Windows 10 using mklink:
cd C:\Python3
mklink python3.exe python.exe
Use a (soft) symbolic link in Linux:
cd /usr/bin/python3
ln -s python.exe python3.exe
In my case I have a git hook on commit, specified by admin. So it was not very convenient for me to change the script (with python3 calls).
And the simplest workaround was just to copy python.exe to python3.exe.
Now I could launch both python and python3.
If python2 is not installed on your computer, you can try with just python instead of python3
For Python 27
virtualenv -p C:\Python27\python.exe django_concurrent_env
For Pyton36
virtualenv -p C:\Python36\python.exe django_concurrent_env
Enter the command to start up the server in that directory:
py -3.7 -m http.server
I had a related issue after installing windows 11, where python3 in cmd would open the windows store. I was able to sort it out between this post and this other one. In short, I reinstalled python and made sure to add it to PATH. Then, in settings, Apps > Apps & Features > App Execution aliases. Here, all I had to do was make sure that every single python .exe (including idle and pip) were turned off EXCEPT FOR the python3.exe alias. Now it works like a charm.
FWIW:
The root of this issue is not with you or with python. Apparently, Microsoft wanted to make installing python easier for young kiddos getting interested in coding, so they automatically add an executable to PATH. For those of us that already have this executable, it can cause these issues.
Found out instead press the play button the top right and it should work in visual studios:
Do not disable according to first answer
Saying python3 in the command will not work by default.
After figuring out the problem with the modules (Solution): https://youtu.be/paRXeLurjE4
Summary:
To import python modules in case of problem to import modules:
Hover over python in search:
Click open in folder
Hover over and right click
click properties
copy everything in path before \python.exe
close those windows
For cmd (administrator):
cd --path that was copied--
then python -m pip install --upgrade pip
cd Scripts
pip install "Name of Package" such as pip install --module (package) --
Im on win10 and have 3.7, 3.8 and 3.10 installed.
For me "python" launches version 3.10 and does not accept commands (like -3.7), "py" launches newest version but does accept commands, and "python3" does nothing.
Uninstalled 3.10 and "python" now does nothing, and "py" launches 3.8.
I am unable to add a comment, but the mlink option presented in this answer above https://stackoverflow.com/a/55229666/8441472 by #Stanislav preserves cross-platform shebangs at the top of scripts (#!/usr/bin/env python3) and launches the right python.
(Even if you install python from python.org, Windows will direct you to the app marketplace nowadays if you type python3 on the command line. If you type python on the same cli it will launch the python.org version repl. It leads to scripts that generate no output, but more likely silently failed completely. I don't know ho common this is but have experienced it on a couple of different devices)
If you have this at the top of your script to ensure you launch python3 and don't feel like editing everything you own, it is not a bad approach at all... lol.

"No such file or directory" running dynamically linked executable in Ubuntu

I'm trying to install AFDKO on Ubuntu. After installation I added environmental variables also. But when I call the command
$ makeotfexe
It returns
bash: /home/randika/FDK/Tools/linux/makeotfexe: No such file or directory
But when I "cd" in to that folder in above path the file exists and can be accessed and opened. What is issue here? How can I correct it?
Guess you are trying to run a 32bit executable in a 64bit environment. Try installing ia32-libs package.

Installing Linux Library on Windows Using Mingw

I am attempting to install GTKExtra on windows. The package comes in a Tar.Gz and contains a Configure file. So its necessary to install the package using MinGw because the package is designed to be installed on Linux.
I have installed MinGW and MSYS. I have made sure that C:\MinGW\msys\1.0\etc\fstab contains the line C:\MinGW /mingw (plus an empty line below it).
My Problem: I still cant get windows run the Configure file. When I type in ./Configure into CMD I get the error '.' is not recognized as an internal or external command, operable program or batch file.
The steps I am taking are:
Open cmd.exe
Navigate to the folder that contains the configure file using cd C:/...
Type in ./configure (as per the instructions found in INSTALL. But this causes the error I described above
How can I run the configure file on windows? What have I done wrong?
You have to run the command in unix command prompt. For starting unix command prompt execute "msys.bat" in msys installation.

Resources