Changing the Anaconda installation directory - python

I'm using Anaconda and Windows 10 and have to install the XGBoost package. I managed to do it for python using this helpful article (http://www.picnet.com.au/blogs/guido/2016/09/22/xgboost-windows-x64-binaries-for-download/) and tried to install it in Anaconda according to this question (Windows xgboost error). Somehow, it appeared that the command 'python setup.py install' tries to change a wrong directory (C:\Program Files... instead of D:\Anaconda...) How can I change the installation directory so that changes are made where they should?

try to activate the correct Anaconda in your console by executing the activate script in the appropriate folder, e.g.:
D:\Anaconda\Scripts\activate
You might have to slightly adjust the path to your installation. If this works, you'll see (base) in front of the next line in the command prompt. On my machine, I get this output:
C:\Users\felix>C:\Users\felix\Anaconda3\Scripts\activate
(base) C:\Users\felix>
After anaconda is activated, executing python should use the correct executable. You can verify this using the command I posted as a comment before:
python -c "import sys; print(sys.executable)"
Does this answer your question?

Related

Have problem to run Python command installed by pip in macOS Terminal

I'm not a Python user, so know little about Python. But I have to install stcgal using pip3 following its official guide.
pip3 install stcgal
However, if I run the installed command in terminal, it says zsh: command not found.
After a long searching, I find it was installed at /Users/myUserName/Library/Python/3.8/bin/. Though I can run the command with that path, it's very inconvenient. I wonder is there any way to run the code in any directory instead having to locate it explicitly?
Try something like this:
python -m stcgal -h
You can create or edit your /Users/yimingliu/.zshrc file (if your macOS is older than macOS Catalina 10.15, then the file is /Users/yimingliu/.bash_profile), and add a line to add the python bin folder to your path:
export PATH=/Users/yimingliu/Library/Python/3.8/bin:$PATH

How to create an executable with a pycharm python file though pyinstaller?

I have been trying to install pyinstaller in order to create an executable of a python project I have been working on, but my pip command simply doesn't work. This is the error I would get "'pip' is not recognized as an internal or external command, operable program or batch file". I have already checked the interpreter of my pycharm project, and it shows that it has pip already installed. I tried to look this up online, and I found out that a problem could be that the environment variable Path just needs to have the directory of my python version, but even after doing this, it still would not work. For additional information, I already tried to find the directory by using the command "where python" in the command prompt, but that path didn't work, and I'm using windows 10.
Usually for most of users, there would be a problem as you mention above. In such situation, you just need to install pip again with command like
python -m pip3 install -U pip
and remember next time, if pip reminds you to upgrade it, do not just use
pip install -U pip

How can I access the vim installed with the anaconda prompt?

I've started the Anaconda python distribution. This comes with something called
'Anaconda prompt' that has conda and git available at the Windows command line.
When I make a commit from this command line, Vim comes up as the editor.
When I type 'vim' or 'vi' at this prompt I get the message:
'vim' is not recognized as an internal or external command, operable
program or batch file.
How can I access vim from the Anaconda prompt?
I was facing the same issue while using vim or vi commands because the package was not installed on my machine. To use the vim command of anaconda prompt with windows os, then use this given command ' conda install -c conda-forge vim '. This command will install the required dependencies and then just simply use the vim command example - vim file_name.
Reference
I am on a mac, but have been using the anaconda prompt on my Windows work machine. You need to add the path of the vim tool to the Windows path environmental variable. I set mine up to use notepad++ when I did a recent install. You can probably find vim in the %APPDATA% directory where anaconda is located if you installed it under the user and not the system. If you search for vim there, you might fine it. If it isn't there it might have gotten installed with another tool.
Install PyVim instead as below and open your textual files in your Anaconda Prompt:
pip install pyvim

<pip3 package> command not found on zsh but found on bash

I installed django on my Ubuntu 16.04 using pip3 install django. But when I type django-admin and hit enter I get command not found. I even verified using:
import django
print(django.get_version())
I use zshell instead of bash. At first I thought this is a django issue. So I installed another pip3 package virtualenv. I then typed virtualenv on terminal and hit enter, same output: command not found.
Then I was sure this is a shell issue. So I changed my shell back to bash and both django-admin and virtuaenv commands were found.
How can I get zsh to discover the pip3 packages?
As you have mentioned, your Python package executables are installed to ~/.local/bin. If you check $PATH in bash, you will find it contains that path. In the default Ubuntu 16.04 installation, this is done in ~/.profile. zsh does not execute this file, however, and so probably does not have ~/.local/bin in its $PATH. The solution as you have found is to add it: this can be done automatically by modifying your .zshrc, e.g.
export PATH=$HOME/.local/bin:$PATH

I can't use pip (Windows)

I'm wanting to learn machine learning, but it requires that I use 'pip.' I'm still very new to a lot of this stuff. I've installed Python 3.4 64-bit and get-py.py.
When I run pip install sklearn I get 'pip' is not recognized as an internal or external command, operable program or batch file.
Here's a screenshot of my environmental variable PATH
https://gyazo.com/c7ec926401878845d5c4f9a556cf00ee
Any help would be greatly appreciated. I have checked out other posts where people had similar issues, but I tried various things and nothing worked.
Easiest solution is to just download a platform like Anaconda for example. It is Python with many libraries (sklearn, pandas, numpy, ...) and also with pip, all in a user-friendly Windows installer package, that takes care of everything for you.
https://www.continuum.io/downloads
If you really want to do it yourself, then
download get-pip.py (https://bootstrap.pypa.io/get-pip.py)
make sure you have Python installed and in your PATH, for example by running python --version in command prompt
Navigate to the directory, where you downloaded get-pip.py (in command prompt using the command cd).
Run the command python get-pip.py from a command prompt with admin privileges (possibly not needed, but just to make sure).
This should be all. Close your command prompt, open it again and run pip --version to test it. If it doesn't work, then search your computer for a file named pip.exe (most likely in your Python directory) and if you find it, add its path to your PATH variable (given the screenshot, I assume you know how to do this).
I downloaded Python 3.6 and the pip was installed on my system.
I found pip at below location:
C:\Users\Admin\AppData\Local\Programs\Python\Python36\Scripts
Also, before I found pip I used below command on my command prompt to install pyperclip:
python -m pip install pyperclip
For anyone that might have installed Python using the MSI installer, and ticked the box to include pip, but still gets the error 'pip' is not recognized as an internal or external command, operable program or batch file:
It looks like that the pip executable is installed in the \Scripts subdirectory of the Python installation, but that directory does not get automatically added to PATH.
For me, since I had installed Python 2.7, the directory was C:\Python27\Scripts. After adding this path to the PATH environment variable, and open a new CMD window, pip was available as a command.
I've made a workaround that will help you, copy the batch script below and modify it as specified:
#"PATH to python.exe" "PATH to pip.exe" %*
For example like this:
#"C:\programming\bin\python374\python.exe" "C:\programming\bin\python374\Scripts\pip.exe" %*
Save this file as pip.bat on Desktop and then move it to C:\Windows\system32.
For Python 3.7 or higher at least (as today is October 4th 2019) in the installation window you need to check the box "add to PATH" when you first install Python.
I'm late now, but just add python to your environment variables.
It´s explained in this short video, how to set up python to your environment variables:
https://www.youtube.com/watch?v=Y2q_b4ugPWk
after that pip should work on your cmd prompt, without cd to
"C:\Users\Admin\AppData\Local\Programs\Python\Python36\Scripts"
This is late but in case anyone runs across this issue, pip installed for me as "pip3". Once I used pip3 as my command and not pip, it worked fine. Threw me for quite a loop since I've been using Python for years.
PIP Install and Upgrade
Ensure you are accessing the right location while accessing pip as shown in my link above. Starting Python 3.4, it is included by default with the Python binary installers.
Environment Variable
It is also a good idea to update the environment variable if the path is not accessible by default, once the installation is complete.
If it is specifically pip you want you could install python again making sure to tick the install pip box which it sounds like you failed to upon initial installation.

Categories

Resources